package com.burpee.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.burpee.dao.CommentsDao;
import com.burpee.ui.Comments;

@Service(value="commentsService")
public class CommentsServiceImpl implements CommentsService {

	@Autowired
	CommentsDao commentsDao;

	public List<Comments> list(long boarditemsNo) {

		return commentsDao.list(boarditemsNo);
	}

	public Comments view(Comments comments) {
		// TODO Auto-generated method stub
		return commentsDao.view(comments);
	}

	public boolean add(Comments comments) {
		if(commentsDao.add(comments) > 0){
			return true;
		}
		else{

			return false;
		}
	}

	public Comments modify(Comments comments) {
		int result = 0;

		result = commentsDao.modify(comments);

		if (result > 0) {
			return commentsDao.view(comments);
		}
		else {
			return null;
		}
	}

	public boolean remove(Comments comments) {
		int result = 0;

		result = commentsDao.remove(comments);

		if (result > 0) {
			return true;
		}
		else {
			return false;
		}

	}
}
